<?php
/*
 * RPSessionInterface.php created on 28 avr. 08 
 * Author: Rodrigue Le Gall
 *
 * RPortal is an open source web based Content Management System
 * Copyright (C) 2002-2008  Rodrigue Le Gall
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
/**
 * internal user session specifications
 * 
 * the user sessions are managed by Components that implement RPSessionManagerInterface interface.
 * This interface specifies the API used by a Session manager and by all other component that requires to set or get data from session.
 * 
 * @author Rodrigue Le Gall <r.legall@rportal.org>
 * @package Kernel
 * 
 * @RPInterface
 */
interface RPSessionInterface {
	/**
	 * copy the given session data in the current instance
	 * @param RPSessionInterface $session session to copy
	 */
	public function copySession(RPSessionInterface $session);
	/**
	 * get an array of all data of the session
	 * @return array data of the session
	 */
	public function getAllData();
	/**
	 * set all the data of the session from an array
	 * @param array $data contains all data to set in the session
	 */
	public function setAllData(array $data);
	/**
	 * set the value of a data in the session
	 * @param string $name name of the data
	 * @param mixed $value value of the data
	 */
	public function set($name, $value);
	/**
	 * get the value of a data in the session
	 * @param string $name name of the data
	 * @return mixed value of the data
	 */
	public function get($name);
	/**
	 * delete a data in the session
	 * @param string $name name of the data 
	 */
	public function delete($name);
	/**
	 * test if a data exists in the session
	 * @param String $name name of the data
	 * @return boolean
	 */
	public function data_exists($name);
	/**
	 * test if the session is valid
	 * @return boolean
	 */
	public function isValid();
	/**
	 * test if the user session allows the execution of the given Rportal function
	 * @param string $function name of the RPortal function
	 * @return boolean
	 */
	public function canExecute($function);
	/**
	 * test if the user session allows to view the given RPortal page
	 * @param string $page name of the given RPortal page
	 * @return boolean
	 */
	public function canView($page);
	/**
	 * set the rights for RPortal function execution*
	 * @param array $rightArray array that contains the list of function that the user can execute 
	 */
	public function setExecutionRights($rightArray);
}